<template>
	<view class="addEditForm">
		<view class="data-form bgfff">
			<view class="data-form-item flex-ac">
				<text class="data-form-label f30">输入框</text>
				<view class="data-form-input">
					<input type="text" :disabled="optionDisabled" v-model="dataForm.keywords" :placeholder="optionDisabled?'-':'请输入关键词'"
						placeholder-class="plStyle" />
				</view>
			</view>
			<view class="data-form-item flex-ac">
				<text class="data-form-label f30">下拉选择</text>
				<view class="data-form-input">
					<cpdd-select v-model="dataForm.selectVal" :disabled="optionDisabled" :list="selectList" keyname="name"
						valname="val"></cpdd-select>
				</view>
			</view>
			<view class="data-form-item flex-ac">
				<text class="data-form-label f30">单个日期选择带时分秒</text>
				<view class="data-form-input">
					<cpdd-date v-model="dataForm.dateVal" :disabled="optionDisabled" :isTime="true"></cpdd-date>
				</view>
			</view>
			<view class="data-form-item flex-ac">
				<text class="data-form-label f30">日期区间选择</text>
				<view class="data-form-input">
					<cpdd-dateRange v-model="cpddDateRangeVal" :disabled="optionDisabled"></cpdd-dateRange>
				</view>
			</view>
			<view class="data-form-item flex-ac">
				<text class="data-form-label f30">日期区间选择带时分秒</text>
				<view class="data-form-input">
					<cpdd-dateRangeTime v-model="cpddDateRangeVal2"></cpdd-dateRangeTime>
				</view>
			</view>
			<view class="data-form-item flex-ac">
				<text class="data-form-label f30">选择图片</text>
				<view class="data-form-input">
					<cpdd-uploadimg v-model="dataForm.imgUrl"></cpdd-uploadimg>
				</view>
			</view>
		</view>
		<view class="right-area-footer2 flex-ac bgfff" v-if="!optionDisabled">
			<view class="saveBtn cancleBtn" @tap="handleCancle">取消</view>
			<view class="saveBtn" @tap="handleSubmit">保存</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				did:'',
				dataForm: { //表单
					keywords: '',
					selectVal: '111',
					dateVal: '',
					// dateRangeVal:''
					startTime: '',
					endTime: '',
					imgUrl:''
				},
				cpddDateRangeVal: '',
				cpddDateRangeVal2: '',
				selectList: [], //上一页带过来，如果上一页用不到，可以在这里调用赋值
				optionDisabled:false,
			}
		},
		onLoad(options) {
			console.log('options',options);
			this.did =options.id||''
			this.optionDisabled = options.op=='look'?true:false
			let title = options.op=='look'?'详情':options.op=='add'?'新增':'编辑'
			uni.setNavigationBarTitle({
				title
			})
		},
		methods: {
			handleCancle(){
				this.$u.back()
			},
			handleSubmit(){
				console.log('提交');
				uni.$emit('reFlashList')
				this.$u.msg('已新增')
				this.$u.back(1,1000)
			}
			
		}
	}
</script>

<style>

</style>
